<template>
  <basic-container>
    <basic-header title="提现列表" />
    <apply-table :action="action" :viewBtn="false" :deleteBtn="false" :addBtn="false" :editBtn="false" :subTitle="subTitle">
      <template slot-scope="{ row }" slot="applyMenu">
        <el-button plain type="success" size="small" @click.stop="handlePass(row)">通过</el-button>
      </template>
    </apply-table>
  </basic-container>
</template>
<script>
import ApplyTable from "@/components/ApplyTable";
import actionTypes from "@/const/action";
import { PromiseWithdrawAudit } from '@/api/config'
// import { mapGetters } from 'vuex'
export default {
  name: "category",
  components: { ApplyTable },
  computed: {
    // ...mapGetters('dic', ['cityCodMap'])
  },
  data() {
    return {
      action: actionTypes.WITHDRAW_MANAGE,
    };
  },
  computed: {
    subTitle(){
      return  '佣金总额：'+this.$store.state.table.withdrawCommission +'元'
    }
  },
  methods: {
    handlePass(row) {
      this.$confirm("确认通过提现吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        PromiseWithdrawAudit(row.id).then(()=>{
          this.$message({
            type: 'success',
            message: "提现已通过"
          })
        }).catch(error=>{
          this.$message({
            type: 'error',
            message: error.message || String(error)
          })
        })
      });
    }
  }
};
</script>
<style>
</style>

